<?php
    header('Content-type:text/html;charset=utf-8');
    $inp = @$_REQUEST['t'] or die("{code:1}");
    // $inp = '1645431779131';
    $file_before = @file("./data/chat.dat") or die("{code:1}");
    $index = 0;
    $flag = false;
    foreach($file_before as $v){
        $tg = explode(':', $v, 2)[0];
        $t = substr($tg, 1, -1);
        if ($t == $inp){
            $flag = true;
            unset($file_before[$index]);
            break;
        }
        $index++;
    }
    if(!$flag){
        die("{code:2}");
    }
    $file_after = fopen("./data/chat.dat", "w");
    foreach($file_before as $v){
        fwrite($file_after, $v);
    }
    fclose($file_after);
    echo "{code:0}";
?>